package com.ycj.entropy.data;

import androidx.room.Dao;
import androidx.room.Delete;
import androidx.room.Insert;
import androidx.room.Query;

import java.util.List;

@Dao
public interface StudyDao {
    @Insert
    void insert(Study study);

    @Query("SELECT * FROM study")
    List<Study> list();

    @Query("SELECT * FROM study ORDER BY id DESC LIMIT :count")
    List<Study> list(int count);

    @Query("SELECT * FROM study ORDER BY id DESC LIMIT :offset,:size")
    List<Study> list(int offset, int size);

    @Query("SELECT * FROM study WHERE title like '%'||:title||'%'")
    List<Study> listByTitle(String title);

    @Delete
    void delete(Study study);

}
